package com.iyimo.core.mvc{
	import com.iyimo.core.i.ICommand;
	import com.iyimo.core.i.IRequest;
	import com.iyimo.core.i.IResponse;

	public class Command implements ICommand{
		public var request:IRequest;
		protected var _response:IResponse;
		
		/**
		 * command编号
		 */		
		private var _id:int;
		
		/**
		 * 服务器返回后回调
		 */		
		protected var _callBack:Function;
		
		/**
		 * 请求服务器
		 * @param id 命令编号
		 */		
		public function Command(id:int){
			_id = id;
		}
		
		public function execute():void{}
		
		/**
		 * 成功后返回
		 * callBack 需要参数IResponse
		 */		
		public function addListener(callBack:Function):void{
			_callBack = callBack;
		}
		
		protected function onSuccess():void{
			_callBack.apply(this, [_response]);
		}
	}
}